#include"proccess.h"
#include<stdio.h>
#include<string.h>
#include<unistd.h>

#define num 101
#define stu '.'
#define ste '='
#define sta '>'
#define RED "\033[31m"
#define GREEN "\033[32m"
#define YELLOW "\033[33m"
#define BLUE "\033[34m"
#define MAGENTA "\033[35m"
#define CYAN "\033[36m"
#define WHITE "\033[37m"
#define RESET "\033[0m"
#define  pnum 3



void pace(double space,double total)
{
   double rate = ( space / total )*100;
  
   char v[num];
   memset(v,'\0',sizeof(v));
   for(int i=0;i<(int)rate;i++)
   {
     v[i]=ste;
   }
   
   static int number=0;
   ++number;
   number%=pnum;
 
   char vt[pnum+1];
   memset(vt,'\0',sizeof(vt));

   for(int i=0;i<pnum;i++)
   {
      if(i<number)
      {
         vt[i]=stu;
      }
      else{
        vt[i]=' ';
      }
   }

   printf("%s[%-100s][%.1f%%]%s\r",GREEN,v,rate,vt);
   fflush(stdout);

}
void pacet(double space,double total)
{
   double rate = ( space / total )*100;
  
   char v[num];
   memset(v,'\0',sizeof(v));
   for(int i=0;i<(int)rate;i++)
   {
     v[i]=ste;
   }
   
   static int number=0;
   ++number;
   number%=pnum;
 
   char vt[pnum+1];
   memset(vt,'\0',sizeof(vt));

   for(int i=0;i<pnum;i++)
   {
      if(i<number)
      {
         vt[i]=stu;
      }
      else{
        vt[i]=' ';
      }
   }

   printf("%s[%-100s][%.1f%%]%s\r",GREEN,v,rate,vt);
   fflush(stdout);

}
